<template>
    <div>
        <van-field label="手机号" placeholder="请输入手机号" v-model="mobile"/>
        <van-field label="验证码" placeholder="请输入验证码" v-model="code"/>
        <van-button @click="send">发送验证码</van-button>
        <br><br>
        <van-button @click="login" color="linear-gradient(to right, #20ffde, #0000ff)" with=200>
            登录
        </van-button>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                mobile:'',
                code:''
            }
        },
        methods:{
            send(){
                this.$axios.post('sendSms',{'mobile':this.mobile})
                .then(res=>{
                    alert(res.data.mes)
                })
            },
            login(){
                this.$axios.post('tlogin',{'mobile':this.mobile,'code':this.code})
                .then(res=>{
                   alert(res.data.mes)
                })
           
            },
        },
        mounted(){},
    }
</script>

<style scoped>

</style>